package com.treasure.mall.zbqmallapi.vo.integral;

import com.treasure.mall.biz.entity.integral.UserIntegralLogPO;
import com.treasure.mall.biz.vo.BaseVO;
import com.treasure.mall.zbq.common.Jsr310Utils;
import com.treasure.mall.zbq.common.ienum.integral.IntegralEnums;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @author allan
 * @version 1.0.0
 * @date 2020/8/27
 */
@Data
@NoArgsConstructor
public class IntegralLogVO implements BaseVO {
    private static final long serialVersionUID = 5869159499875556389L;

    private Long id;
    /**
     * 用户id
     */
    private Long userId;
    /**
     * 变动的积分值
     */
    private long integral;
    /**
     * 日志类型{@link com.treasure.mall.zbq.common.ienum.integral.IntegralEnums.LogType}
     */
    private IntegralEnums.LogType logType;
    /**
     * 订单id
     */
    private String orderId;
    /**
     * 直播场次
     */
    private String liveSessionId;
    /**
     * 是否成功
     */
    private boolean success;
    private String remark;
    /**
     * 时间
     */
    private String createTime;

    public IntegralLogVO(UserIntegralLogPO po) {
        this.id = po.getId();
        this.userId = po.getUserId();
        this.integral = po.getIntegral();
        this.logType = po.getLogType();
        this.orderId = po.getOrderId();
        this.liveSessionId = po.getLiveSessionId();
        this.success = po.isSuccess();
        this.remark = po.getRemark();
        this.createTime = Jsr310Utils.DateTime.asString(po.getCreateTime());
    }
}
